import request from '@/utils/request';

// 查询排课约束条件列表
export function listConstraint(query) {
  return request({
    url: '/jwgl/constraint/list',
    method: 'get',
    params: query
  });
}

// 查询排课约束条件详细
export function getConstraint(id) {
  return request({
    url: '/jwgl/constraint/' + id,
    method: 'get'
  });
}

// 新增排课约束条件
export function addConstraint(data) {
  return request({
    url: '/jwgl/constraint',
    method: 'post',
    data: data
  });
}

// 修改排课约束条件
export function updateConstraint(data) {
  return request({
    url: '/jwgl/constraint',
    method: 'put',
    data: data
  });
}

// 删除排课约束条件
export function delConstraint(id) {
  return request({
    url: '/jwgl/constraint/' + id,
    method: 'delete'
  });
}

// 获取指定学期的启用约束条件
export function getEnabledConstraints(semester) {
  return request({
    url: '/jwgl/constraint/enabled/' + semester,
    method: 'get'
  });
}

// 批量更新约束条件权重
export function updateWeights(data) {
  return request({
    url: '/jwgl/constraint/weights',
    method: 'put',
    data: data
  });
}